package com.qianzhu8.kfc.boot.util;

import lombok.experimental.UtilityClass;

import java.util.Map;

/**
 * class
 *
 * @author xuyanjun
 * @date 2020/5/7
 */
@UtilityClass
public class UrlParamsUtils {

    public static String toParams(Map<String,Object> paramsMap){
        StringBuilder paramBuilder = new StringBuilder();
        paramsMap.forEach((k, v) ->
                paramBuilder.append(String.format("%s=%s&", k, v == null ? "" : v))
        );
       return paramBuilder.substring(0, paramBuilder.length()-1);
    }
}
